package com.wiscamp.ninechapters.problems.infrastructure.po.types;

import com.wiscamp.ninechapters.ddd.PersistenceObject;
import jakarta.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serial;

/**
 * 题型与问题类型关联数据对象
 */
@Entity
@Table(name = "type_relations")
@Data
@EqualsAndHashCode
public class TypeRelationPO implements PersistenceObject {
    @Serial
    private static final long serialVersionUID = -4763325713136655407L;

    /**
     * 编号
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", insertable = false, nullable = false)
    private long id = 0;

    /**
     * 题型编号
     */
    @Column(name = "problem_type_id", nullable = false)
    private long problemTypeId = 0;

    /**
     * 问题类型编号
     */
    @Column(name = "question_type_id", nullable = false)
    private long questionTypeId = 0;

    public TypeRelationPO() {
        //
    }

    public TypeRelationPO(long problemTypeId, long questionTypeId) {
        this.problemTypeId = problemTypeId;
        this.questionTypeId = questionTypeId;
    }
}